package com.demo;

public class SingleTest {
    private static SingleTest instance;
    private SingleTest() {} //构造方法
    public static SingleTest getInstance(){
        if (null == instance){
            synchronized (SingleTest.class){
                if (null == instance){
                    instance = new SingleTest();
                }
            }
        }
        return instance;
    }
}
